package com.cxk.hr.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.cxk.hr.dao.DepartmentMapper;
import com.cxk.hr.pojo.Department;
import com.cxk.hr.service.DepartmentService;

@Service("departmentService")
public class DepartmentServiceImpl implements DepartmentService {
	@Resource
	private DepartmentMapper departmentMapper;

	@Override
	public Department selectByNumber(Integer departmentNumber) {
		Department department = departmentMapper.selectByNumber(departmentNumber);
		return department;
	}

	@Override
	public List<Department> selectListByPage(Integer pageNo, Integer pageSize) {
		List<Department> departments = departmentMapper.selectListByPage(pageNo, pageSize);
		return departments;
	}

	@Override
	public List<Department> selectList() {
		List<Department> departments = departmentMapper.selectList();
		return departments;
	}

	public DepartmentMapper getDepartmentMapper() {
		return departmentMapper;
	}

	public void setDepartmentMapper(DepartmentMapper departmentMapper) {
		this.departmentMapper = departmentMapper;
	}

	public Integer findCountDepartment() {
		Integer count = departmentMapper.findCountDepartment();
		return count;
	}

	public List<Department> findDepartmentByLimit(Integer currentPageNo, Integer pageSize) {
		List<Department> list = departmentMapper.findDepartmentByLimit(currentPageNo, pageSize);
		return list;
	}

	public Integer addDepartment(Department department) {
		Integer count = departmentMapper.saveDepartment(department);
		return count;
	}

	public Department findDepartmentById(Integer id) {
		Department department = departmentMapper.findDepartmentById(id);
		return department;
	}

	public Integer updateDepartment(Department department) {
		Integer count = departmentMapper.updateDepartment(department);
		return count;
	}

	public Integer deleteDepartment(Integer id) {
		Integer count = departmentMapper.deleteDepartment(id);
		return count;
	}

}
